feat: ESI rate-limit overhaul Phase 2+3 — eveapi#670
Open
herpaderpaldent wants to merge 6 commits into
Open
Conversation
- Fix handleException(): 429→release, 420→release, 5xx→release with Retry-After - Add EsiJobReleasedException sentinel (silent catch in handle()) - EsiBase: tries 3→10, backoff extended, EsiProactiveRateLimitMiddleware added - EsiRequestContainer: add compatibility_date propagation - RetrieveEsiData: wire compatibility_date to EsiConfiguration singleton - collect($response) → collect($response->data) in 15 job files (ArrayObject removed) - EsiProactiveRateLimitMiddleware: proactive token-bucket throttling via Redis - composer.json: path repository for local esi-client dev (remove after PR #22 merges) - .gitignore: exclude .phpunit.cache/ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…iddleware enforcement - JobChecker.checkVersion(): gracefully handle missing x-alternate-versions; warn when endpoint uses x-compatibility-date (new ESI versioning scheme) - JobChecker.checkMiddleware(): require EsiProactiveRateLimitMiddleware in all jobs - JobChecker.checkRateLimit(): new check for x-rate-limit spec extension (future ESI) - JobChecker.checkJob(): add checkRateLimit() to pipeline (7 checks total) - ResolveUniverseStructureByIdJob: add EsiProactiveRateLimitMiddleware to middleware() - JobCheckerTest: 5 new tests (compatibility-date×2, rate-limit×3), 1 new middleware test All 36 jobs pass seatplus:check:endpoints ✓ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Require PHP ^8.5 (targeting current stable) - Upgrade pest, pest-plugin-laravel, pest-plugin-type-coverage to ^4.0 - Upgrade larastan to ^3.0 (requires configDirectories in phpstan config) - Upgrade phpstan-deprecation-rules and phpstan-phpunit to ^2.0 - Upgrade rector to ^2.0, driftingly/rector-laravel to ^2.0 - Add configDirectories: [config] to phpstan.neon.dist (larastan 3 requirement) - Generate phpstan-baseline.neon for pre-existing larastan 3 strictness errors - Remove dead catches for replaced exception types in RetrieveEsiData - Add typed class constants (const string/int/float/array) throughout - Add FORK_MEM_PER_PROC workaround for pest-plugin-type-coverage v4 + PHP 8.5 parallel fork race condition (known upstream bug) - Update esi-client constraint ^3.0 → ^4.0 and re-add path repo for local dev - Update CI workflows: php-version 8.3 → 8.5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…erty Removes reliance on the now-deleted __get/__isset shim in esi-client v4. All job executeJob() methods now explicitly access the decoded response body via $response->data->property instead of the deprecated magic proxy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add 35 readonly class DTOs in DataTransferObjects/Responses/ organized by subdomain (Alliances, Assets, Character, Contacts, Contracts, Corporation, Killmails, Mail, Skills, Universe, Wallet) - Each DTO has from(object $data): self factory; optional ESI fields use nullable defaults - Update all jobs to use typed DTOs instead of stdClass magic access: AllianceInfoJob, CharacterAssetJob, CharacterAssetsNameJob, CharacterAffiliationJob, CharacterInfoJob, CharacterRoleJob, CorporationHistoryJob, CharacterContractsJob, ContractItemsJob, CorporationDivisionsJob, CorporationInfoJob, CorporationMemberTrackingJob, KillmailJob, MailBodyJob, MailHeaderJob, SkillQueueJob, SkillsJob, all 8 Universe jobs, CharacterBalanceJob, CorporationBalanceJob, WalletJournalBase, WalletTransactionBase - Update ProcessContactResponse and ProcessContactLabelsResponse services - Remove all optional(), data_get(), property_exists() calls on ESI data Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2+3 of the ESI rate-limit overhaul (depends on esi-client PR #22).
Critical bug fix (Phase 2)
429/420 responses were permanently killing jobs —
handleException()calledfail()on all 4xx, but 429 and 420 should be retried. This is live now with ESI's floating-window rate limit system.Phase 2 Changes
Bug fixes
RetrieveFromEsiBase: catchEsiRateLimitedException/EsiErrorLimitedExceptionbeforeRequestFailedException→ callrelease($retryAfter)instead offail()handleException(): ServerException (5xx) now respectsRetry-Afterheader for delayNew: EsiJobReleasedException sentinel
release()to stopexecuteJob()body from continuingEsiBase::handle()— no noise in error reportingNew: EsiProactiveRateLimitMiddleware
recordResponse()stores rate-limit state to Redis after each successful ESI callEsiBase improvements
$tries: 3 → 10 (rate limits need many retry cycles)backoff(): extended to 9 entries (15min cap)EsiProactiveRateLimitMiddlewaretomiddleware()EsiRequestContainer + RetrieveEsiData
?string $compatibility_date = nullpropagation through toEsiConfigurationcollect($response) → collect($response->data)
Updated 15 files after
EsiResponsedroppedArrayObjectinheritance (Phase 1 change):Phase 3 Changes — JobChecker future-proofing
checkVersion()
x-alternate-versions(no more undefined index crash)x-compatibility-date(new ESI versioning scheme CCP is planning)checkMiddleware()
EsiProactiveRateLimitMiddlewarein all jobscheckRateLimit() (new check)
EsiProactiveRateLimitMiddlewareis present when endpoint declaresx-rate-limitextension (future ESI spec field)ResolveUniverseStructureByIdJob
EsiProactiveRateLimitMiddleware(overridesmiddleware()independently)Test results
MigrateDbTest— MySQL not available in dev env)seatplus:check:endpoints: ✅ All 36 jobs passDependencies
Remaining after merge